package net.message
{

	import flash.utils.IDataInput;

	import net.MessageType;
	import net.data.EquipListOnHero;
	import net.data.EquipItemInfo;
	import net.handler.GC_Equip_ShowAvailableHandler;

	import util.Long;

	/**
	 * 文件名：GC_Equip_ShowAvailableMessage.as
	 * <p>
	 * 功能：显示指定英雄可装备的列表，无指定英雄时server端取默认英雄
	 * <p>
	 * 版本：1.0.0
	 * <p>
	 * 作者：Builderd by AppTools
	 * <p>
	 */
	public class GC_Equip_ShowAvailableMessage extends BaseMessage
	{
		public var equipListOnHero:Vector.<EquipListOnHero>;
		public var equipProvider:Vector.<EquipItemInfo>;

		public function GC_Equip_ShowAvailableMessage()
		{
			super();
			type = MessageType.GC_Equip_ShowAvailable;
			handler = new GC_Equip_ShowAvailableHandler();
		}

		override public function readMessage(data:IDataInput):void
		{

			equipListOnHero = new Vector.<EquipListOnHero>;
			//写入list长度
			var size:int = data.readByte();

			//循环写入数据
			for(var i:int = 0; i < size; i++)
			{

				var heroInfo:EquipListOnHero = new EquipListOnHero();

				//写入装备key-主键
				heroInfo.equipId = Long.read(data);
				//写入装备模板code
				heroInfo.equipCode = data.readInt();
				//写入装备级别
				heroInfo.lv = data.readInt();

				equipListOnHero.push(heroInfo);
			}
			equipProvider = new Vector.<EquipItemInfo>;
			//写入list长度
			size = data.readByte();

			//循环写入数据
			for(var j:int = 0; j < size; j++)
			{

				var equipInfo:EquipItemInfo = new EquipItemInfo();

				//写入装备key-主键
				equipInfo.equipId = Long.read(data);
				//写入装备模板code
				equipInfo.equipCode = data.readInt();
				//写入装备级别
				equipInfo.lv = data.readInt();

				equipProvider.push(equipInfo);
			}
		}
	}
}
